! File Name:     Hayes Accura 56K
! Version:       2.00
!
! Modified date: 5/23/97 by Rich M @ Hayes
! Modified date: 12/6/95 by Rich M @ Hayes
! Modified date: 12/17/93 by Jerry @ Hayes
! Modified by Russ Reynaga, 1.Dec.93 to correct minor errors
!
!
@ORIGINATE
@ANSWER
!
@LABEL 1
!
serreset 57600, 0, 8, 1
!
! &F     = Recall factory configuration
! S7=90  = Set wait time for carrier to 90 seconds
! S10=90 = Set lost carrier hang up to 90 
! &Q6    = Communicate in asynchronous mode with automatic speed buffering
!          (ASB) for interfaces requiring constant speed between the DTE
!          (computer/terminal) and the DCE (modem).
! W2     = Do not return negotiation progress messages; return CONNECT messages
!          using modem-to-modem (DCE) speeds instead of modem-to-DTE speeds.
!
matchclr
settries 0
matchstr 1 5 "OK\13\10"
@LABEL 2
write "AT&FS7=90S10=90E0&Q6W2\13"
matchread 30
inctries
iftries 2 59
jump 2
!
! If speaker ON flag is true, jump to label 8.  Else turn off the speaker
!
@LABEL 5
matchclr
ifstr 2 8 "1"
matchstr 1 8 "OK\13\10"
write "ATM0\13"
matchread 30
jump 59
!
! The modem is ready.  So enable answering, or originate a call
!
@LABEL 8
ifANSWER 42
note "Dialing ^1" 3
write "ATS0=0DT^1\13"
!
@LABEL 9
matchstr  1 18 "CONNECT 19200\13\10"
matchstr  2 19 "CONNECT 16800\13\10"
matchstr  3 20 "CONNECT 21600\13\10"
matchstr  4 21 "CONNECT 24000\13\10"
matchstr  5 22 "CONNECT 26400\13\10"
matchstr  6 23 "CONNECT 28800\13\10"
matchstr  7 24 "CONNECT 31200\13\10"
matchstr  8 25 "CONNECT 33600\13\10"
matchstr  9 26 "CONNECT 32000\13\10"
matchstr  10 27 "CONNECT 34000\13\10"
matchstr  11 28 "CONNECT 36000\13\10"
matchstr  12 29 "CONNECT 38000\13\10"
matchstr  13 30 "CONNECT 40000\13\10"
matchstr  14 31 "CONNECT 42000\13\10"
matchstr  15 32 "CONNECT 44000\13\10"
matchstr  16 33 "CONNECT 46000\13\10"
matchstr  17 50 "NO CARRIER\13\10"
matchstr  18 50 "ERROR\13\10"
matchstr  19 52 "NO DIALTONE\13\10"
matchstr  20 53 "BUSY\13\10"
matchstr  21 54 "NO ANSWER\13\10"
matchread 700
jump 59
! 
@LABEL 12
note "Communicating at 2400 bps." 2
CommunicatingAt 2400
jump 40
!
@LABEL 15
note "Communicating at 9600 bps." 2
CommunicatingAt 9600
jump 40
!
@LABEL 16
note "Communicating at 12000 bps." 2
CommunicatingAt 12000
jump 40
!
@LABEL 17
note "Communicating at 14400 bps." 2
CommunicatingAt 14400
jump 40
!
@LABEL 18
note "Communicating at 19200 bps." 2
CommunicatingAt 19200
jump 40
!
@LABEL 19
note "Communicating at 16800 bps." 2
CommunicatingAt 16800
jump 40
!
@LABEL 20
note "Communicating at 21600 bps." 2
CommunicatingAt 21600
jump 40
!
@LABEL 21
note "Communicating at 24000 bps." 2
CommunicatingAt 24000
jump 40
!
@LABEL 22
note "Communicating at 26400 bps." 2
CommunicatingAt 26400
jump 40
!
@LABEL 23
note "Communicating at 28800 bps." 2
CommunicatingAt 28800
jump 40
!
@LABEL 24
note "Communicating at 31200 bps." 2
CommunicatingAt 31200
jump 40
!
@LABEL 25
note "Communicating at 33600 bps." 2
CommunicatingAt 33600
jump 40
!
@LABEL 26
note "Communicating at 32000 bps." 2
CommunicatingAt 32000
jump 40
!
@LABEL 27
note "Communicating at 34000 bps." 2
CommunicatingAt 34000
jump 40
!
@LABEL 28
note "Communicating at 36000 bps." 2
CommunicatingAt 36000
jump 40
!
@LABEL 29
note "Communicating at 38000 bps." 2
CommunicatingAt 38000
jump 40
!
@LABEL 30
note "Communicating at 40000 bps." 2
CommunicatingAt 40000
jump 40
!
@LABEL 31
note "Communicating at 42000 bps." 2
CommunicatingAt 42000
jump 40
!
@LABEL 32
note "Communicating at 44000 bps." 2
CommunicatingAt 44000
jump 40
!
@LABEL 33
note "Communicating at 46000 bps." 2
CommunicatingAt 46000
jump 40
!
!
!
@LABEL 40
!
!   Make sure ARA is set for hardware handshaking
!
HSReset 0 1 0 0 0 0
ifANSWER 41
pause 30
!
@LABEL 41
exit 0
!
! @ANSWER
! Set up modem to answer on second ring
!
@LABEL 42
write "ATS0=2\13"
matchstr 1 43 "OK\13\10"
matchread 30
jump 59
!
@LABEL 43
matchstr  1 18 "CONNECT 19200\13\10"
matchstr  2 19 "CONNECT 16800\13\10"
matchstr  3 20 "CONNECT 21600\13\10"
matchstr  4 21 "CONNECT 24000\13\10"
matchstr  5 22 "CONNECT 26400\13\10"
matchstr  6 23 "CONNECT 28800\13\10"
matchstr  7 24 "CONNECT 31200\13\10"
matchstr  8 25 "CONNECT 33600\13\10"
matchstr  9 26 "CONNECT 32000\13\10"
matchstr  10 27 "CONNECT 34000\13\10"
matchstr  11 28 "CONNECT 36000\13\10"
matchstr  12 29 "CONNECT 38000\13\10"
matchstr  13 30 "CONNECT 40000\13\10"
matchstr  14 31 "CONNECT 42000\13\10"
matchstr  15 32 "CONNECT 44000\13\10"
matchstr  16 33 "CONNECT 46000\13\10"
matchstr  17 50 "NO CARRIER\13\10"
matchstr  18 50 "ERROR\13\10"
matchstr  19 52 "NO DIALTONE\13\10"
matchstr  20 53 "BUSY\13\10"
matchstr  21 54 "NO ANSWER\13\10"
matchread 700
jump 43
!
@LABEL 44
userhook 1
note "Answering phone" 2
jump 43
!
! 50: error messages
!
@LABEL 50
exit -6021
!
@LABEL 52
exit -6020
!
@LABEL 53
exit -6022
!
@LABEL 54
exit -6023
!
@LABEL 59
note "Communicating at an unknown rate." 2
jump 40
!
! Hang up the modem
!
@HANGUP
@LABEL 60
settries 0
HSReset 0 0 0 0 0 0
@LABEL 61
pause 5
write "ATZH\13"
matchclr
matchstr 1 64 "OK\13\10"
matchstr 2 63 "NO CARRIER\13\10"
matchstr 3 64 "ERROR\13\10"
matchread 30
inctries
iftries 3 64
!
! no response, try escape sequence
!
write "+++"
matchclr
matchstr 1 62 "OK\13\10"
matchread 20
!
! still no response from modem, toggle DTR
!
DTRClear
pause 10
DTRSet
jump 61
!
@LABEL 62
matchclr
matchstr 1 64 "OK\13\10"
matchstr 2 63 "NO CARRIER\13\10"
write "ATZH\13"
matchread 30
jump 61
!
@LABEL 63
pause 10
flush
!
! Recall the factory settings
!
@LABEL 64
matchclr
matchstr 1 65 "OK\13\10"
write "AT&F\13"
matchread 30
!
@LABEL 65
matchstr 1 66 "OK\13\10"
write "ATS0=0\13"
matchread 30
!
@LABEL 66
exit 0
